﻿using System.Threading.Tasks;
using Aquarinum.WebSocekt.Core.Dtos;

namespace Aquarinum.Base.Infrastructure.WebSocket.Interface
{
    /// <summary>
    ///     数据发送代理（用于发布消息）
    ///     <remarks>直接调用socket中间件发送（单体服务），或者在RabiitMq中发布消息（集群）</remarks>
    /// </summary>
    public interface IMessageSendProxy
    {
        Task SendMessageAsync(string clientId,
            string messageJson, long expireSecond = 0,
            bool needPersistence = false, bool needReceipt = false);

        Task SendMessageAsync(string clientId,
            WebsocketMessageDto message, long expireSecond = 0,
            bool needPersistence = false, bool needReceipt = false);


        Task Publish(
            WebsocketMessageDto message, long expireSecond = 0,
            bool needPersistence = false, bool needReceipt = false);

        Task PublishWithGroup(string groupid,
            WebsocketMessageDto message, long expireSecond = 0,
            bool needPersistence = false, bool needReceipt = false);


        Task SendReceiptAsync(string clientId, ReceiptMessageDto message);
    }
}